while True:
    try:
        pwd=input()
        upper="ABCDEFGHIJKLMNOPQUVWXYZ"
        lower="abcdefghijklmnopquvwxyz"
        shuzi="0123456789"
        upper_s,lower_s,shuzi_s,else_s=0,0,0,0
        s,nums=0,0
        for i in pwd:
            if i in upper:
                upper_s=1
                s+=1
            elif i in lower:
                lower_s=1
                s+=1
            elif i in shuzi:
                shuzi_s=1
                s+=1
        if s<len(pwd):
            else_s=1

        nums=upper_s+lower_s+shuzi_s+else_s
        if nums >= 3 and len(pwd)>8:
            print("OK")
        else:
            print("NG")
    except:
        break